import instance from "./request.js"

export function fetchLunbo() {
    return instance.get('/getlunbo')
}

export function fetchRecommendGoods(page = 1, limit = 10) {
    return instance.get(`/recommend?page=${page}&limit=${limit}`)
}

// 添加地址
export function fetchAddAddress(user_id, data) {
    return instance.post(`/addaddress/${user_id}`, data)
}

// 获取用户地址
export function fetchUserAddress(user_id) {
    return instance.get(`/getaddress/${user_id}`)
}

// 删除用户地址
export function fetchDelUserAddress(address_id) {
    return instance.post(`/deladdress/${address_id}`)
}

// 修改用户地址
export function fetchEditUserAddress(address_id, data) {
    return instance.post(`/updateaddress/${address_id}`, data)
}

// 获取购物车中的商品
export function fetchCarGoods(ids) {
    // ids => 98,99
    return instance.get(`/getshopcarlist/${ids}`)
}